package com.ruanyuan.springboot.dao;

import com.ruanyuan.springboot.pojo.Car;

import java.util.List;
import java.util.Map;

public class Batch {
    /* 批量删除车辆信息 */
    public String batchDeleteCar(Map map) {
        List<String> ids = (List<String>) map.get("list");
        StringBuilder sb = new StringBuilder();
        sb.append("DELETE FROM car WHERE Id IN (");
        for (int i = 0; i < ids.size(); i++) {
            sb.append("'").append(ids.get(i)).append("'");
            if (i < ids.size() - 1)
                sb.append(",");
        }
        sb.append(")");
        return sb.toString();
    }
    /* 批量删除用户 */
    public String batchDeleteUser(Map map) {
        List<String> ids = (List<String>) map.get("list");
        StringBuilder sb = new StringBuilder();
        sb.append("DELETE FROM employee WHERE Id IN (");
        for (int i = 0; i < ids.size(); i++) {
            sb.append("'").append(ids.get(i)).append("'");
            if (i < ids.size() - 1)
                sb.append(",");
        }
        sb.append(")");
        return sb.toString();
    }
}
